package com.xuankejun;

import android.app.Activity;
import android.content.Intent;
import android.media.Image;
import android.os.Bundle;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.widget.ImageView;

public class Welcome extends Activity {
	private AlphaAnimation alpha;
	View view;
	ImageView iv;
	 @Override
	protected void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);
	        view = View.inflate(this, R.layout.welcome, null);
	        setContentView(view);
	        initView();
	        initData();
	    }
	 
	 private void initView(){
		 
	 }

	 private void initData(){
		 alpha = new AlphaAnimation(0.1f, 1.0f);
		 alpha.setDuration(2222);
		 view.startAnimation(alpha);
		 alpha.setAnimationListener(new AnimationListener() {
			
			@Override
			public void onAnimationStart(Animation arg0) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void onAnimationRepeat(Animation arg0) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void onAnimationEnd(Animation arg0) {
				// TODO Auto-generated method stub
				toMainActivity();
			}
		});
	 }
	 
	 private void toMainActivity(){
		 startActivity(new Intent(getApplicationContext(), MainActivity.class));
		 finish();
	 }
}
